﻿using System;

class Program
{
    static void Main()
    {
        Console.Write("请输入数组的长度: ");
        int length = Convert.ToInt32(Console.ReadLine());

        int[] arr = new int[length];

        for (int i = 0; i < length; i++)
        {
            Console.Write($"请输入第{i + 1}个元素: ");
            arr[i] = Convert.ToInt32(Console.ReadLine());
        }
       
        int maxVal = arr[0];
        int minVal = arr[0];
        int totalSum = 0;

        foreach (int num in arr)
        {
            if (num > maxVal)
            {
                maxVal = num;
            }
            if (num < minVal)
            {
                minVal = num;
            }
            totalSum += num;
        }

        double avgVal = (double)totalSum / arr.Length;

        Console.WriteLine("最大值: " + maxVal);
        Console.WriteLine("最小值: " + minVal);
        Console.WriteLine("平均值: " + avgVal);
        Console.WriteLine("总和: " + totalSum);
        Console.ReadKey();
    }
}